"""" 
Copyright 2009 Texas A&M University
 
Licensed under the Apache License, Version 2.0 (the "License"); you may not use 
this file except in compliance with the License. You may obtain a copy of the 
License at

http://www.apache.org/licenses/LICENSE-2.0
  
Unless required by applicable law or agreed to in writing, software distributed 
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 
CONDITIONS OF ANY KIND, either express or implied. See the License for the 
specific language governing permissions and limitations under the License.
"""
from zope.interface import Interface

from zope.schema import List, TextLine, Object

from meercat.mapreduce.interfaces import IReducer
from meercat.interfaces import IOrderedRegistry



class ISolrProcessor(Interface):
    def __call__(self, metadata={}):
        """ Perform an action on a dictionary of metadata in place """

class ISolrFieldReducer(Interface):
    """ Interface for a field reducer callable. """
    
    def __call__(self, values):
        """ Return an iterable container of values after reduction """ 

class ISolrReducer(IReducer):
    preprocessors = Object(schema=IOrderedRegistry)
    postprocessors = Object(schema=IOrderedRegistry)
    formats = List(value_type=TextLine(), required=True, default=['solr'])
    defaultFieldReduction = Object(schema=ISolrFieldReducer, required=False,
                                   default=None)


